//
//  CancleOutHolidayViewController.m
//  AttendenceSys
//
//  Created by ld on 16/1/18.
//  Copyright © 2016年 窦芳俊. All rights reserved.
//

#import "CancleOutHolidayViewController.h"

@interface CancleOutHolidayViewController ()

@end

@implementation CancleOutHolidayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.strNavTitle = @"销外出假";
    
    [self initData];
    
    [self initView];
    // Do any additional setup after loading the view.
}

-(void)initData
{
    _cancleOutHolidayArr = [[NSMutableArray alloc] init];
   
    CancleOutHolidayInfo* canOutInfo = [[CancleOutHolidayInfo alloc] init];
    canOutInfo.appBegEndTime = @"2016-1-1";
    canOutInfo.approveTime = @"2016-1-1";
    canOutInfo.appType = Approve_YES;
    canOutInfo.outHoliday = @"外出假";
    
    [_cancleOutHolidayArr addObject:canOutInfo];
    
    CancleOutHolidayInfo* canOutInfo1 = [[CancleOutHolidayInfo alloc] init];
    canOutInfo1.appBegEndTime = @"2016-1-2";
    canOutInfo1.approveTime = @"2016-1-2";
    canOutInfo1.appType = Approve_YES;
    canOutInfo1.outHoliday = @"外出假";
    
    [_cancleOutHolidayArr addObject:canOutInfo1];
    
    CancleOutHolidayInfo* canOutInfo2 = [[CancleOutHolidayInfo alloc] init];
    canOutInfo2.appBegEndTime = @"2016-1-3至2016-1-6";
    canOutInfo2.approveTime = @"2016-1-3";
    canOutInfo2.appType = Approve_NO;
    canOutInfo2.outHoliday = @"外出假";
    
    [_cancleOutHolidayArr addObject:canOutInfo2];
    
    CancleOutHolidayInfo* canOutInfo3 = [[CancleOutHolidayInfo alloc] init];
    canOutInfo3.appBegEndTime = @"2016-1-7";
    canOutInfo3.approveTime = @"2016-1-7";
    canOutInfo3.appType = Approve_NO;
    canOutInfo3.outHoliday = @"外出假";
    
    [_cancleOutHolidayArr addObject:canOutInfo3];
    
}

-(void)initView
{
    _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [_tableView registerClass:[CancleOutHolidayCell class] forCellReuseIdentifier:NSStringFromClass([CancleOutHolidayCell class])];
    [self.view addSubview:_tableView];
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_cancleOutHolidayArr count];
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CancleOutHolidayCell* cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([CancleOutHolidayCell class])];
    [cell setBackgroundColor:[UIColor clearColor]];
    
    CancleOutHolidayInfo* cancleInfo = [_cancleOutHolidayArr objectAtIndex:indexPath.row];
    cell.appBegEndTimeLab.text = [NSString stringWithFormat:@"%@   外出假",cancleInfo.appBegEndTime];
    cell.appTimeLab.text = [NSString stringWithFormat:@"申请时间: %@",cancleInfo.approveTime];
    cell.appInfoLab.text = [cell appInfoForAppType:cancleInfo.appType];
    
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return Cancle_OutHolidayHeight+10;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    //    DcNAppProNotiMeetInfo* approveInfo = [_tmpArray objectAtIndex:[indexPath row]];
    //    DcNItemInfoViewController* itemInfoVC = [[DcNItemInfoViewController alloc] init];
    //    [itemInfoVC saveURL:approveInfo.pageLink];
    //
    //    [self.navigationController pushViewController:itemInfoVC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
